package com.xiaofengwx.remind;

import com.xiaofengwx.remind.data.MyChineseDate;
import com.xiaofengwx.remind.data.MyDateTime;

public class BeetxJni {

	static {
		System.loadLibrary("beetxcore");
	}

	public native String test();

	public native boolean DateTimeToChineseL(int[] aDateTime, int[] aChineseDate);

	public native boolean ChineseToDateTimeL(int[] aChineseDate, int[] aDateTime);

	public native void DateRangeG(int[] aDateTime, int[] bDateTime);

	public native void DateRangeN(int[] aChineseDate, int[] bChineseDate);

	public boolean DateTimeToChineseL(MyDateTime aDateTime, MyChineseDate aChineseDate) {
		int[] x = MyDateTime.mallocArray();
		int[] y = MyChineseDate.mallocArray();

		aDateTime.export_(x);
		boolean tmp = DateTimeToChineseL(x, y);
		aChineseDate.init(y);
		return tmp;
	}

	public boolean ChineseToDateTimeL(MyChineseDate aChineseDate, MyDateTime aDateTime) {
		int[] x = MyChineseDate.mallocArray();
		int[] y = MyDateTime.mallocArray();

		aChineseDate.export_(x);
		boolean tmp = ChineseToDateTimeL(x, y);
		aDateTime.init(y);
		return tmp;
	}

	public void DateRange(MyDateTime aLower, MyDateTime aUpper) {
		int[] x = MyDateTime.mallocArray();
		int[] y = MyDateTime.mallocArray();
		DateRangeG(x, y);
		aLower.init(x);
		aUpper.init(y);
	}

	public void DateRange(MyChineseDate aLower, MyChineseDate aUpper) {
		int[] x = MyChineseDate.mallocArray();
		int[] y = MyChineseDate.mallocArray();
		DateRangeN(x, y);
		aLower.init(x);
		aUpper.init(y);
	}
}
